package com.example.di0xml;

public class Student {

    private String name;
    private int age;
    //引用类型
    private School school;


    public Student() {
        System.out.println("student无参数构造方法");
    }

    //创建有参数构造方法
    public Student (String myname,int myage, School mySchool){
        System.out.println("Student 有参数构造方法");
        //给属性依次赋值
        this.name = myname;
        this.age = myage;
        this.school = mySchool;
    }

    public void setName(String name) {
        System.out.println("setName==" + name);
        this.name = name;//也可不赋值，可随意写
    }


    public void setAge(int age) {
        System.out.println("setAge===" + age);
        this.age = age;
    }

    public void setSchool(School school) {
        System.out.println("setschool=="+school);
        this.school = school;
    }

    //    public void setEmail(String email){
//        //email属性 <property name="email" value="lisi@qq.com" />
//        System.out.println("setEmail==="+email);
//    }


    @Override
    public String toString() {
        return "Student{" +
                "name='" + name + '\'' +
                ", age=" + age +
                ", school=" + school +
                '}';
    }
}



